# Copyright (C) 2025 Kumo inc.
# Author: Jeff.li lijippy@163.com
# All rights reserved.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <https:#www.gnu.org/licenses/>.
#
# distutils: language = c++

from myclass cimport MyClass  # 导入接口声明

cdef class PyMyClass:
    cdef MyClass * c_obj  # 持有 C++ 对象指针

    def __cinit__(self, int value):
        self.c_obj = new MyClass(value)  # 构造 C++ 对象:ml-citation{ref="2,3" data="citationList"}

    def get_value(self):
        return self.c_obj.get_value()

    def set_value(self, int value):
        self.c_obj.set_value(value)

    def __dealloc__(self):
        if self.c_obj is not NULL:
            del self.c_obj  # 释放内存:ml-citation{ref="3,5" data="citationList"}
